package ace.module.captcha.core.impl.api.impl;

import ace.cmp.core.model.R;
import ace.module.captcha.api.CaptchaApplicationApi;
import ace.module.captcha.api.model.dto.CaptchaApplicationDto;
import ace.module.captcha.core.impl.dao.entity.CaptchaApplication;
import ace.module.captcha.core.impl.manager.CaptchaApplicationManager;
import ace.module.common.api.annotation.ApiLocalPriority;
import ace.module.common.core.impl.api.impl.SdkApiImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * .
 * @author Caspar
 *
 */
@ApiLocalPriority
@AllArgsConstructor
@Component
public class CaptchaApplicationApiImpl
    extends SdkApiImpl<CaptchaApplication, Long, CaptchaApplicationDto, CaptchaApplicationManager>
    implements CaptchaApplicationApi {

  @Override
  public R<CaptchaApplicationDto> getByKey(String key) {
    CaptchaApplicationDto result = this.getManager().getDtoByKey(key);
    return R.ok(result);
  }

  @Override
  public R<CaptchaApplicationDto> getAndCheckNotNullAdminApplication() {
    CaptchaApplicationDto result = this.getManager().getDtoAndCheckNotNullAdminApplication();
    return R.ok(result);
  }
}
